﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using VAdvantage.Model;
using System.IO;

using System.Text;
using VAdvantage.Utility;
using VAdvantage.DataBase;
using System.Reflection;


namespace VAdvantage.Scheduler
{
    public partial class AppointmentForm : ChildWindow
    {



        #region Record's Appointmnet

        public AppointmentForm()
        {
            InitializeComponent();

            Type type = Envs.GetC1ModuleType("VC1Module.UI.AppointmentControl");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(VAdvantage.Scheduler.AppointmentForm) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { this
                        });
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    throw new Exception("No Std Constructor");
                }
            }

        }

        public AppointmentForm(int ID)
        {
            InitializeComponent();
            Assembly asm = null;
            Type type = Envs.GetC1ModuleType("VC1Module.UI.AppointmentControl");
           
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(int), typeof(VAdvantage.Scheduler.AppointmentForm) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        ID,this});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    throw new Exception("No Std Constructor");
                }
            }
        }

        public AppointmentForm(int ID, bool isTask)
        {
            InitializeComponent();
           
            Type type = Envs.GetC1ModuleType("VC1Module.UI.AppointmentControl");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(int), typeof(bool), typeof(VAdvantage.Scheduler.AppointmentForm) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        ID,isTask,this});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    throw new Exception("No Std Constructor");
                }
            }
        }

        public AppointmentForm(int AD_Table_ID, int AD_Record_ID, bool isTask)
        {
            InitializeComponent();
            Type type = Envs.GetC1ModuleType("VC1Module.UI.AppointmentControl");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(int), typeof(int), typeof(bool), typeof(VAdvantage.Scheduler.AppointmentForm) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        AD_Table_ID,AD_Record_ID,isTask,this});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    throw new Exception("No Std Constructor");
                }
            }
        }

        public AppointmentForm(List<int> recordIDs, int tableId, bool isTask, bool isRoleCenForm)    //By Karan
        {
            InitializeComponent();
            Type type = Envs.GetC1ModuleType("VC1Module.UI.AppointmentControl");
            if (type != null)
            {
                System.Reflection.ConstructorInfo constructor = null;
                try
                {
                    constructor = type.GetConstructor(new Type[] { typeof(List<int>), typeof(int), typeof(bool), typeof(bool), typeof(VAdvantage.Scheduler.AppointmentForm) });
                }
                catch (Exception e)
                {
                    //log.Warning("No transaction Constructor for " + type.FullName + " (" + e.ToString() + ")");
                }
                if (constructor != null)
                {
                    try
                    {

                        object ig = constructor.Invoke(new object[] { 
                        recordIDs,tableId,isTask,isRoleCenForm,this});
                        container.Children.Add(ig as UIElement);
                    }
                    catch
                    {

                    }
                }
                else
                {
                    throw new Exception("No Std Constructor");
                }
            }
        }

        #endregion

    }
}

